<?php
class Config
{

    static private $config = array();

    static public function get($name)
    {
        if (empty(self::$config))
        {
            self::importAllConfig();
        }

        return isset(self::$config[$name]) ? self::$config[$name] : null;
    }

    private static function importAllConfig()
    {
        $modelConfig = new common_model(null, 'config', 'id');

        $res = $modelConfig->find_all(1);

        foreach ($res as $item)
        {
            self::$config[$item['name']] = $item['value'];
        }

        return true;
    }

}
